{% extends "base.html" %}
{% block head %}
    <meta charset="UTF-8">
    <title>测试管理系统</title>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
    <link rel="stylesheet" href="../static/layui/css/layui.css">
    <script type="text/javascript" src="../static/js/echarts.js"></script>
    <script type="text/javascript" src="../static/js/echarts.min.js"></script>
    <script type="text/javascript" src="../static/js/china.js"></script>
    <script src="../static/js/jquery-1.11.3.min.js"></script>
    <script src="../static/layui/layui.js"></script>
    <!--     <script type="text/javascript">try { Typekit.load(); } catch (e) { }</script> -->
    <script type="text/javascript" src="../static/js/tool_p.js"></script>
    <link href="https://www.layuicdn.com/layui-v2.5.6/css/layui.css" rel='stylesheet'/>
    <script src="https://www.layuicdn.com/layui-v2.5.6/layui.js"></script>
{% endblock head %}
{% block left %}
    {{ super() }}
{% endblock left %}
{% block right %}
    {{ super() }}
    <!-- 修改name（页面名称） -->
    {% set name = 'bug率统计(天)' %}
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>{{ name }}</legend>
    </fieldset>
    <!-- {{ data[0] }} -->
   <!--  <blockquote class="layui-elem-quote" style="font-size: 18px;color: forestgreen;font-weight: bold">bug率统计
    </blockquote> -->
    <div class="layui-tab layui-tab-card">
        <ul class="layui-tab-title">
            <li class="layui-this">bug密度</li>
            <li>首轮漏测率</li>
            <li>引入错误率</li>
        </ul>
        <div class="layui-tab-content" style="height: 630px;width:1030">
            <div class="layui-tab-item layui-show">
                <div id="trend" style="display: block;width: 1500px;height:600px;float:left"></div>
            </div>
            <div class="layui-tab-item">
                <div id="handler" style="display: block;width: 1500px;height:600px;float:left"></div>
            </div>
            <div class="layui-tab-item">
                <div id="reporter" style="display: block;width: 1500px;height:600px;float:left"></div>
            </div>
        </div>
    </div>

<!-- 弹窗列表 #009688-->
<div class="layui-card layui-form" id="openbuglist">
    <table class="layui-hide" id="layListId" lay-filter="layList"></table>
</div>

    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例prover

        var myChartrend = echarts.init(document.getElementById('trend'));
        var myCharhandler = echarts.init(document.getElementById('handler'));
        var myCharreporter = echarts.init(document.getElementById('reporter'));

        var bugcount = [];
        var bugdensity = [];
        var fristleak = [];
        var bringerror = [];

        // bug密度
        var bugdensityy = {
            title: {
                text: 'bug密度'
            },
            tooltip: {},
            legend: {
                data: ['bug密度']
            },
            xAxis: {
                data: bugcount,
                axisLabel: {
                    interval: 0,
                    rotate: 50
                }
            },
            yAxis: {},
            series: [{
                name: 'bug密度',
                type: 'line',
                data: bugdensity
            }]
        }
        // bug总数
        var fristleakk = {
            title: {
                text: '首轮漏测率'
            },
            tooltip: {},
            legend: {
                data: ['首轮漏测率']
            },
            xAxis: {
                data: bugcount,
                axisLabel: {
                    interval: 0,
                    rotate: 50
                }
            },
            yAxis: {},
            series: [{
                name: '首轮漏测率',
                type: 'line',
                data: fristleak
            }]
        }

        // 引入错误率
        var bringerrorr = {
            title: {
                text: '引入错误率'
            },
            tooltip: {},
            legend: {
                data: ['引入错误率']
            },
            xAxis: {
                data: bugcount,
                axisLabel: {
                    interval: 0,
                    rotate: 50
                }
            },
            yAxis: {},
            series: [{
                name: '引入错误率',
                type: 'line',
                data: bringerror
            }]
        }
        window.onload = function () {
            var xmlhttp;
            xmlhttp = new XMLHttpRequest();
            xmlhttp.open("POST", "calcu_day", true);
            xmlhttp.send();
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.status == 200 && xmlhttp.readyState == 4) {
                    var dataa = JSON.parse(xmlhttp.responseText)
                    for (let i = 0; i < dataa.length; i++) {
                        // console.log(c)
                        // names.push(c[i].proname + "-" + c[i].versionname)
                        // checknum.push(c[i].checknum)
                        bugcount.push(dataa[i].addtime)
                        bugdensity.push(dataa[i].density)
                        fristleak.push(dataa[i].leakage)
                        bringerror.push(dataa[i].lead)
                    }
                }

                // 使用刚指定的配置项和数据显示图表。
                    myChartrend.setOption(bugdensityy);
                    myCharhandler.setOption(fristleakk);
                    myCharreporter.setOption(bringerrorr);
            }

        }
    </script>

{% endblock right %}
<!-- 此模板现有部分，除页面名称外，其他均不可编辑 -->